<template>
	<view>
		<HMfilterDropdown :filterData="filterData" :defaultSelected ="filterDropdownValue" @confirm="confirm"></HMfilterDropdown>
		<view class="space"></view>
		<food-list ref="flist"></food-list>
	</view>
</template>

<script>
	import foodList from "../../list/food-list/food-list.vue"
	import HMfilterDropdown from '@/components/HM-filterDropdown/HM-filterDropdown.vue';
	export default{
		components:{
			foodList,
			'HMfilterDropdown':HMfilterDropdown 
		},
		data(){
			 return {
			   filterData:[{
				   "name":"排序",
				   "type":"hierarchy",
				   "submenu":[{
					   "name":"最热门",
					   "value":1
				   },{
					   "name":"最新",
					   "value":2
				   }
				   ]
			   },
				   {
				   "name":"类别",
				   "type":"hierarchy",
				   "submenu":[{
					   "name":"全类别",
					   "value":0
				   },
				   {
					   "name":"特色小吃",
					   "value":1
				   },
				   {
					   "name":"异域美食",
					   "value":2
				   },
				   {
					   "name":"甜点饮品",
					   "value":3
				   },
				   {
					   "name":"能量早餐",
					   "value":4
				   },
				   {
					   "name":"正餐优选",
					   "value":5
				   },
				   {
					   "name":"夜宵必备",
					   "value":6
				   },
				   
				   ]
			   }]
			        }
		},
		methods:{
			confirm(e){
				console.log(e)
				if(e.index[1][0]){
					console.log(e.value[1][0])
					this.$refs.flist.getTagFood(e.value[1][0])
				}
				else{
					if(e.index[0][0]==1){
						this.$refs.flist.getNewFood()
					}
					else{
						this.$refs.flist.getHotFood()
					}
				}
			}
		}
	}
</script>

<style lang="less">
	.space{
		min-height:50px;
		min-width:100%;
	}
	
</style>
